var isClick=true;
function Game(list){
    base(this,LSprite,[]);//此类继承Sprite
    var self=this;

    self.bg=new LBitmap(new LBitmapData(datalist['bg0']));
    self.addChild(self.bg);
    self.bg.y=stageH/2-self.bg.getHeight()/2;

    self.p0=new P0();
    self.addChild(self.p0);
    self.p0.y=stageH/2-self.p0.getHeight()/2;

    self.p1=new P1();
    self.addChild(self.p1);
    self.p1.x=640;
    self.p1.y=stageH/2-self.p1.getHeight()/2;

    self.nav=new Nav();
    self.addChild(self.nav);
    self.nav.x=stageW/2-self.nav.getWidth()/2;
    self.nav.y=stageH*0.9;

    self.sub=new P2();
    self.addChild(self.sub);
    self.sub.y=stageH/2-self.sub.bg.getHeight()/2;
    self.sub.alpha=0;
    self.sub.visible=false;
}

Game.prototype.p0to1=function(){
    var self=this;
    isClick=false;

    self.p0.PageOut();
    self.p1.PageIn();
    LTweenLite.to(self.p1,0.8,{x:0, ease:Cubic.easeOut});
    LTweenLite.to(self.p0,0.8,{x:-640, ease:Cubic.easeOut,onComplete:function(){
        isClick=true;
    }});
}

Game.prototype.p1to0=function(){
    var self=this;
    isClick=false;

    self.p1.PageOut();
    self.p0.PageIn();
    LTweenLite.to(self.p1,0.8,{x:640, ease:Cubic.easeOut});
    LTweenLite.to(self.p0,0.8,{x:0, ease:Cubic.easeOut,onComplete:function(){
        isClick=true;
    }});
}

Game.prototype.subIn=function(){
    var self=this;

    LTweenLite.to(self.nav,0.2,{alpha:0,onComplete:function(){
        self.nav.visible=false;
    }});

    setTimeout(function(){
        self.sub.visible=true;
        LTweenLite.to(self.sub,0.3,{alpha:1,onComplete:function(){
            self.sub.sub1In();
        }});
    },200);
}

Game.prototype.subOut=function(){
    var self=this;
    LTweenLite.to(self.sub,0.5,{alpha:0,onComplete:function(){
        self.sub.visible=false;
        self.sub.subOut();
        self.p1.goHome();

        self.nav.visible=true;
        LTweenLite.to(self.nav,0.5,{alpha:1,delay:1});
    }});
}








